{template 'public/header'}

{template 'public/comhead'}

<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcss.css">

<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li class="active"><a href="javascript:void(0);">管理员添加</a></li>
    <li><a href="{php echo $this->createWebUrl('branchadminlist',array('bid'=>$bid));}"><i class="fa fa-refresh"></i>返回管理员列表</a></li>
</ul>
<div class="main ygmain">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default ygdefault">

            <div class="panel-heading wyheader">

                管理员添加

            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">手机号</label>
                    <div class="col-sm-9">
                        <!--<input type="text" name="uid" class="form-control" value="{$info['uid']}" onblur="findname()" readonly/>-->
                        <input type="text" name="phone" class="form-control" value="{$info['phone']}" onblur="findname()" {if $info['phone'] > 0 } readonly{/if}/>
                        <span class="help-block" id="username">请输入手机号查询</span>
                    </div>
                </div>
                <div class="form-group">
                    <label  class="col-sm-2 control-label">管理员权限</label>
                    <div class="col-sm-10">
                        <label class="radio-inline">
                            <input onchange="check(this)" type="radio" name="auth" value="1" {if $info['auth']==1 || empty ($info['auth'])}checked{/if} />
                            <label >门店管理员</label>
                        </label>
                        <!--<label class="radio-inline">-->
                            <!--<input onchange="check(this)" type="radio"  name="auth" value="2" {if $info['auth']==2}checked{/if} />-->
                            <!--<label>核销员</label>-->
                        <!--</label>-->
                        <span class="help-block" >* 一个门店可以添加多个门店管理员</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">

            <input type="submit" name="submit" value="保存设置" class="btn col-lg-3" style="color: white;background-color: #444444;margin-left: 550px;"/>

            <input type="hidden" name="token" value="{$_W['token']}" />
            <input type="hidden" name="id" value="{$info['id']}" />
            <input type="hidden" name="bid" value="{$bid}" />

        </div>

    </form>

</div>
<script type="text/javascript">
    $(function(){
        $("#frame-1").show();
        $("#yframe-1").addClass("wyactive");
    })

    function findname() {
        var phone=$('input[name="phone"]').val();
        $.ajax({
            type:"post",
            url:"{php echo $this->createWebUrl('addbranchadmin',array('op'=>'findname'))}",
            dataType:"json",
            data:{phone:phone},
            success:function(data){
                console.log(data);
                if(data){
                    $('#username').html('请确认用户昵称为：'+data.user_name);
                }else{
                    $('#username').html('当前用户不存在');
                }

            }
        })
    }
</script>